package ScalaSpark

import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;

object ScalaParallelizeCollection {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setAppName("ScalaParallelizeCollection")
      .setMaster("local")

    val sc = new SparkContext(conf)

    val numbers = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

    val numberRDD = sc.parallelize(numbers, 3)

    val sum = numberRDD.reduce(_ + _)

    println("1到10的累加和：" + sum)

  }
}
